package marmalius;

public class MagicSpells {

    public int hitDiff;
    public int rune1;
    public int rune1am;
    public int rune2;
    public int rune2am;
    public int rune3;
    public int rune3am;
    public int rune4;
    public int rune4am;
    public int gID1;
    public int gID2;
    public int gID3;
    public int charge;

    public MagicSpells() {
        hitDiff = 0;
        rune1 = 0;
        rune1am = 0;
        rune2 = 0;
        rune2am = 0;
        rune3 = 0;
        rune3am = 0;
        rune4 = 0;
        rune4am = 0;
        gID1 = 0;
        gID2 = 0;
        gID3 = 0;
        charge = 0;
    }

    public void CastSpell(int i, int j, int k, int l, int i1, int j1) {
        try {
            //PlayerHandler _tmp = PlayerHandler.getInstance();
            client client1 = (client) PlayerHandler.getInstance().getPlayer(i);

            if ((client1.playerName != null || client1.playerName != "null")
                    && client1.GoodDistance(l, i1, client1.absX, client1.absY, 6)) {
                RunesNeeded(k);
                int k1 = (client1.absX - l) * 0;
                int l1 = (client1.absY - i1) * 0;

                if (client1.magicTimer <= 0 && j1 > 0) {
                    if (k == 1191
                            && client1.playerEquipment[client1.playerWeapon]
                                    != 2416
                                            || k == 1192
                                                    && client1.playerEquipment[client1.playerWeapon]
                                                            != 2417
                                                            || k == 1190
                                                                    && client1.playerEquipment[client1.playerWeapon]
                                                                            != 2415) {
                        client1.sendMessage(
                                "You need a battle staff for this spell!");
                        hitDiff = 0;
                    } else {
                        if (rune1 > 0) {
                            client1.deleteItem(rune1, client1.getItemSlot(rune1),
                                    rune1am);
                        }
                        if (rune2 > 0) {
                            client1.deleteItem(rune2, client1.getItemSlot(rune2),
                                    rune2am);
                        }
                        if (rune3 > 0) {
                            client1.deleteItem(rune3, client1.getItemSlot(rune3),
                                    rune3am);
                        }
                        if (rune4 > 0) {
                            client1.deleteItem(rune4, client1.getItemSlot(rune4),
                                    rune4am);
                        }
                        client1.startAnimation(Emote(k));
                        if (k == 12871) {
                            client1.stillgfx(367, client1.absY, client1.absX);
                        }
                        client1.magicTimer = 14;
                        if (Mage(i, j, l, i1)) {
                            hitDiff = misc.random(SpellDamage(k));
                            if (gID3 > 0) {
                                client1.ProjectileSpell(gID1, gID2, gID3,
                                        client1.absY, client1.absX, l1, k1, j,
                                        i1, l);
                            }
                            if (gID3 <= 0) {
                                client1.stillgfx(gID1, i1, l);
                            }
                            if (FreezeNPC(k)) {
                                if (MultiIceBararage(k)) {
                                    AttackNpcIceWithin(gID1, SpellDamage(k), 6,
                                            i);
                                }
                                if (NPCHandler.getInstance().getNPC(j).freezeTimer <= 0) {
                                	NPCHandler.getInstance().getNPC(j).freezeTimer = 35;
                                }
                            }
                            if (PoisonNPC(k)) {
                                if (MultiPoisonBararage(k)) {
                                    AttackNpcPoisonWithin(gID1, SpellDamage(k),
                                            1, i);
                                }
                                NPCHandler.getInstance().PoisonNPC(j);
                            }
                            if (MultiWeakenBararage(k)) {
                                AttackNpcMageWithin(gID1, SpellDamage(k), 1, i);
                            }
                            if (DrainNPC(k)) {
                                if (MultiDrainBararage(k)) {
                                    AttackNpcMageWithin(gID1, SpellDamage(k), 1,
                                            i);
                                }
                                client1.NewHP += hitDiff / 2;
                                if (client1.NewHP
                                        > client1.getLevelForXP(
                                                client1.playerXP[3])) {
                                    client1.NewHP = client1.getLevelForXP(
                                            client1.playerXP[3]);
                                }
                            }
                        }
                        NPCHandler.getInstance().getNPC(j).RandomWalk = false;
                        NPCHandler.getInstance().getNPC(j).hitDiff = hitDiff;
                        NPCHandler.getInstance().getNPC(j).Killing[client1.playerId] += hitDiff;
                        NPCHandler.getInstance().getNPC(j).updateRequired = true;
                        NPCHandler.getInstance().getNPC(j).hitUpdateRequired = true;
                        NPCHandler.getInstance().getNPC(j).IsUnderAttack = true;
                        NPCHandler.getInstance().getNPC(j).StartKilling = client1.playerId;
                        NPCHandler.getInstance().getNPC(j).followPlayer = client1.playerId;
                        client1.teleportToX = client1.absX;
                        client1.teleportToY = client1.absY;
                        if (client1.playerLevel[6] < 40) {
                            client1.addSkillXP(
                                    500 * client1.playerLevel[6]
                                            + client1.playerLevel[6],
                                            6);
                            client1.addSkillXP(
                                    500 * client1.playerLevel[3]
                                            + client1.playerLevel[3],
                                            3);
                        }
                        double d = 0.0D;

                        d = 1000 * hitDiff;
                        d *= 1.0D;
                        client1.addSkillXP((int) d, client1.playerMagic);
                        client1.addSkillXP((int) d, client1.playerHitpoints);
                        resetMA();
                    }
                }
            }
        } catch (Exception exception) {}
    }

    public boolean MultiIceBararage(int i) {
        if (i == 12881) {
            return true;
        }
        return i == 12891;
    }

    public boolean MultiPoisonBararage(int i) {
        if (i == 12963) {
            return true;
        }
        return i == 12975;
    }

    public boolean MultiDrainBararage(int i) {
        if (i == 12919) {
            return true;
        }
        return i == 12929;
    }

    public boolean MultiWeakenBararage(int i) {
        if (i == 13011) {
            return true;
        }
        return i == 13023;
    }

    public void AttackNpcMageWithin(int i, int j, int k, int l) {
        label0: {
            client client1 = (client)PlayerHandler.getInstance().getPlayer(l);
            int i1 = 0;

            do {
                if (i1 > NPCHandler.getInstance().getMaxNPC()) {
                    break label0;
                }
                if (NPCHandler.getInstance().getNPC(i1) != null
                        && client1.GoodDistance(NPCHandler.getInstance().getNPC(i1).absX,
                        NPCHandler.getInstance().getNPC(i1).absY, client1.absX,
                        client1.absY, k)
                        && !NPCHandler.getInstance().getNPC(i1).IsDead
                        && NPCHandler.getInstance().getNPC(i1).HP != 0) {
                    int j1 = misc.random(j);

                    client1.stillgfx(i, NPCHandler.getInstance().getNPC(i1).absY,
                            NPCHandler.getInstance().getNPC(i1).absX);
                    if (NPCHandler.getInstance().getNPC(i1).HP - hitDiff < 0) {
                        j1 = NPCHandler.getInstance().getNPC(i1).HP;
                    }
                    hitDiff = j1;
                    NPCHandler.getInstance().getNPC(i1).StartKilling = client1.playerId;
                    NPCHandler.getInstance().getNPC(i1).RandomWalk = false;
                    NPCHandler.getInstance().getNPC(i1).IsUnderAttack = true;
                    NPCHandler.getInstance().getNPC(i1).hitDiff = j1;
                    NPCHandler.getInstance().getNPC(i1).updateRequired = true;
                    NPCHandler.getInstance().getNPC(i1).hitUpdateRequired = true;
                    double d = 0.0D;

                    d = 1000 * hitDiff;
                    d *= 1.0D;
                    client1.addSkillXP((int) d, client1.playerMagic);
                    client1.addSkillXP((int) d, client1.playerHitpoints);
                }
                i1++;
            } while (true);
        }
    }

    public void AttackNpcPoisonWithin(int i, int j, int k, int l) {
        label0: {
            //PlayerHandler _tmp = PlayerHandler.getInstance();
            client client1 = (client)PlayerHandler.getInstance().getPlayer(l);
            int i1 = 0;

            do {
                //NPCHandler _tmp1 = server.npcHandler;

                if (i1 > NPCHandler.getInstance().getMaxNPC()) {
                    break label0;
                }
                if (NPCHandler.getInstance().getNPC(i1) != null
                        && client1.GoodDistance(NPCHandler.getInstance().getNPC(i1).absX,
                        NPCHandler.getInstance().getNPC(i1).absY, client1.absX,
                        client1.absY, k)
                        && !NPCHandler.getInstance().getNPC(i1).IsDead
                        && NPCHandler.getInstance().getNPC(i1).HP != 0) {
                    int j1 = misc.random(j);

                    client1.stillgfx(i, NPCHandler.getInstance().getNPC(i1).absY,
                            NPCHandler.getInstance().getNPC(i1).absX);
                    if (NPCHandler.getInstance().getNPC(i1).HP - hitDiff < 0) {
                        j1 = NPCHandler.getInstance().getNPC(i1).HP;
                    }
                    hitDiff = j1;
                    NPCHandler.getInstance().PoisonNPC(i1);
                    NPCHandler.getInstance().getNPC(i1).StartKilling = client1.playerId;
                    NPCHandler.getInstance().getNPC(i1).RandomWalk = false;
                    NPCHandler.getInstance().getNPC(i1).IsUnderAttack = true;
                    NPCHandler.getInstance().getNPC(i1).hitDiff = j1;
                    NPCHandler.getInstance().getNPC(i1).updateRequired = true;
                    NPCHandler.getInstance().getNPC(i1).hitUpdateRequired = true;
                    double d = 0.0D;

                    d = 1000 * hitDiff;
                    d *= 1.0D;
                    client1.addSkillXP((int) d, client1.playerMagic);
                    client1.addSkillXP((int) d, client1.playerHitpoints);
                }
                i1++;
            } while (true);
        }
    }

    public void AttackNpcIceWithin(int i, int j, int k, int l) {
        label0: {
            client client1 = (client)PlayerHandler.getInstance().getPlayer(l);
            int i1 = 0;

            do {
                if (i1 > NPCHandler.getInstance().getMaxNPC()) {
                    break label0;
                }
                if (NPCHandler.getInstance().getNPC(i1) != null
                        && client1.GoodDistance(NPCHandler.getInstance().getNPC(i1).absX,
                        NPCHandler.getInstance().getNPC(i1).absY, client1.absX,
                        client1.absY, k)
                        && !NPCHandler.getInstance().getNPC(i1).IsDead
                        && NPCHandler.getInstance().getNPC(i1).HP != 0) {
                    int j1 = misc.random(j);

                    client1.stillgfx(i, NPCHandler.getInstance().getNPC(i1).absY,
                            NPCHandler.getInstance().getNPC(i1).absX);
                    if (NPCHandler.getInstance().getNPC(i1).HP - hitDiff < 0) {
                        j1 = NPCHandler.getInstance().getNPC(i1).HP;
                    }
                    hitDiff = j1;
                    if (NPCHandler.getInstance().getNPC(i1).freezeTimer <= 0) {
                        NPCHandler.getInstance().getNPC(i1).freezeTimer = 35;
                    }
                    NPCHandler.getInstance().getNPC(i1).StartKilling = client1.playerId;
                    NPCHandler.getInstance().getNPC(i1).RandomWalk = false;
                    NPCHandler.getInstance().getNPC(i1).IsUnderAttack = true;
                    NPCHandler.getInstance().getNPC(i1).hitDiff = j1;
                    NPCHandler.getInstance().getNPC(i1).updateRequired = true;
                    NPCHandler.getInstance().getNPC(i1).hitUpdateRequired = true;
                    double d = 0.0D;

                    d = 1000 * hitDiff;
                    d *= 1.0D;
                    client1.addSkillXP((int) d, client1.playerMagic);
                    client1.addSkillXP((int) d, client1.playerHitpoints);
                }
                i1++;
            } while (true);
        }
    }

    public void CastSpellPlayer(int i, int j, int k, int l, int i1, int j1) {
        try {
            client client1 = (client)PlayerHandler.getInstance().getPlayer(i);
            client client2 = (client)PlayerHandler.getInstance().getPlayer(j);
            int k1 = j;

            client1.MageAttackIndex = j;
            if ((client1.playerName != null || client1.playerName != "null")
                    && client1.GoodDistance(l, i1, client1.absX, client1.absY, 6)) {
                RunesNeeded(k);
                int l1 = (client1.absX - l) * 0;
                int i2 = (client1.absY - i1) * 0;

                if (playerHasItemAmount(rune1, rune1am, i)
                        && playerHasItemAmount(rune2, rune2am, i)
                        && playerHasItemAmount(rune3, rune3am, i)
                        && playerHasItemAmount(rune4, rune4am, i)) {
                    if (k == 1191
                            && client1.playerEquipment[client1.playerWeapon]
                                    != 2416
                                            || k == 1192
                                                    && client1.playerEquipment[client1.playerWeapon]
                                                            != 2417
                                                            || k == 1190
                                                                    && client1.playerEquipment[client1.playerWeapon]
                                                                            != 2415) {
                        client1.sendMessage(
                                "You need a battle staff for this spell!");
                        hitDiff = 0;
                    } else {
                        if (rune1 > 0) {
                            client1.deleteItem(rune1, client1.getItemSlot(rune1),
                                    rune1am);
                        }
                        if (rune2 > 0) {
                            client1.deleteItem(rune2, client1.getItemSlot(rune2),
                                    rune2am);
                        }
                        if (rune3 > 0) {
                            client1.deleteItem(rune3, client1.getItemSlot(rune3),
                                    rune3am);
                        }
                        if (rune4 > 0) {
                            client1.deleteItem(rune4, client1.getItemSlot(rune4),
                                    rune4am);
                        }
                        client1.startAnimation(Emote(k));
                        double d = 0.0D;

                        d = 600 * hitDiff;
                        d *= 1.0D;
                        client1.addSkillXP((int) d, client1.playerMagic);
                        client1.addSkillXP((int) d, client1.playerHitpoints);
                        if (Mage2(i, l, i1, j)) {
                            hitDiff = misc.random(SpellDamage(k));
                            if (gID3 > 0) {
                                client1.ProjectileSpell(gID1, gID2, gID3,
                                        client1.absY, client1.absX, l1, i2,
                                        k1 + 1, i1, l);
                            }
                            if (gID3 <= 0) {
                                client1.stillgfx(gID1, i1, l);
                            }
                            if (k == 12871) {
                                client1.stillgfx(367, client1.absY, client1.absX);
                            }
                            if (FreezeNPC(k) && client2.EntangleDelay <= 0) {
                                client2.EntangleDelay = 35;
                            }
                            if (k == 12445) {
                                client2.teleBlockTimer = 250;
                            }
                            if (PoisonNPC(k)) {
                                client2.PoisonPlayer();
                            }
                            if (DrainNPC(k)) {
                                client1.NewHP += hitDiff / 2;
                                if (client1.NewHP
                                        > client1.getLevelForXP(
                                                client1.playerXP[3])) {
                                    client1.NewHP = client1.getLevelForXP(
                                            client1.playerXP[3]);
                                }
                            }
                        }
                        PlayerHandler.getInstance().getPlayer(j).hitUpdateRequired = true;
                        PlayerHandler.getInstance().getPlayer(j).updateRequired = true;
                        PlayerHandler.getInstance().getPlayer(j).appearanceUpdateRequired = true;
                        PlayerHandler.getInstance().getPlayer(j).hitDiff = hitDiff;
                        client1.teleportToX = client1.absX;
                        client1.teleportToY = client1.absY;
                        resetMA();
                    }
                }
            }
        } catch (Exception exception) {}
    }

    public boolean Mage2(int i, int j, int k, int l) {
        client client1 = (client)PlayerHandler.getInstance().getPlayer(i);
        client client2 = (client)PlayerHandler.getInstance().getPlayer(l);

        if (client1.playerName != null || client1.playerName != "null") {
            int i1 = client1.playerBonus[3] + client1.playerLevel[6];
            //int j1 = CheckBestBonus(l);
            int k1 = client2.playerBonus[9];

            if (misc.random(i1) + client1.playerLevel[6] > misc.random(k1)) {
                return true;
            }
            int l1 = l;

            client1.MageAttackIndex = l;
            int i2 = (client1.absX - j) * 0;
            int j2 = (client1.absY - k) * 0;

            if (gID3 > 0) {
                client1.ProjectileSpell(gID1, gID2, 85, client1.absY,
                        client1.absX, i2, j2, l1 + 1, k, j);
            }
            if (gID3 <= 0) {
                client1.stillgfx(85, k, j);
            }
            return false;
        } else {
            return false;
        }
    }

    public boolean Mage(int i, int j, int k, int l) {
        client client1 = (client)PlayerHandler.getInstance().getPlayer(i);

        if (client1.playerName != null || client1.playerName != "null") {
            int i1 = client1.playerBonus[3] + client1.playerLevel[6];
            int j1 = CheckBestBonus(i);
            int k1 = client1.playerBonus[j1];

            if (misc.random(i1) + client1.playerLevel[6] > misc.random(k1)) {
                return true;
            }
            int l1 = (client1.absX - k) * 0;
            int i2 = (client1.absY - l) * 0;

            if (gID3 > 0) {
                client1.ProjectileSpell(gID1, gID2, 85, client1.absY,
                        client1.absX, i2, l1, j, l, k);
            }
            if (gID3 <= 0) {
                client1.stillgfx(85, l, k);
            }
            return false;
        } else {
            return false;
        }
    }

    public int CheckBestBonus(int i) {
        client client1 = (client)PlayerHandler.getInstance().getPlayer(i);

        if (client1.playerName != null || client1.playerName != "null") {
            if (client1.playerBonus[6] > client1.playerBonus[7]
                    && client1.playerBonus[6] > client1.playerBonus[8]) {
                return 6;
            }
            if (client1.playerBonus[7] > client1.playerBonus[6]
                    && client1.playerBonus[7] > client1.playerBonus[8]) {
                return 7;
            }
            return client1.playerBonus[8] <= client1.playerBonus[6]
                    || client1.playerBonus[8] <= client1.playerBonus[7]
                            ? 0
                            : 8;
        } else {
            return 0;
        }
    }

    public boolean playerHasItemAmount(int i, int j, int k) {
        client client1 = (client)PlayerHandler.getInstance().getPlayer(i);

        if (client1.playerName != null || client1.playerName != "null") {
            if (rune1 > 0) {
                client1.playerHasItemAmount(rune1, rune1am);
            }
            if (rune2 > 0) {
                client1.playerHasItemAmount(rune2, rune2am);
            }
            if (rune3 > 0) {
                client1.playerHasItemAmount(rune3, rune3am);
            }
            if (rune4 > 0) {
                client1.playerHasItemAmount(rune4, rune4am);
            }
        }
        return true;
    }

    public boolean resetMA() {
        rune1 = 0;
        rune1am = 0;
        rune2 = 0;
        rune2am = 0;
        rune3 = 0;
        rune3am = 0;
        rune4 = 0;
        rune4am = 0;
        gID1 = 0;
        gID2 = 0;
        gID3 = 0;
        charge = 0;
        hitDiff = 0;
        return true;
    }

    public boolean RunesNeeded(int i) {
        if (i == 1152) {
            rune1 = 558;
            rune1am = 1;
            rune2 = 556;
            rune2am = 1;
            rune3 = 0;
            rune3am = 0;
            rune4 = 0;
            rune4am = 0;
            gID1 = 90;
            gID2 = 91;
            gID3 = 92;
            return true;
        }
        if (i == 1153) {
            rune1 = 555;
            rune1am = 3;
            rune2 = 557;
            rune2am = 2;
            rune3 = 559;
            rune3am = 1;
            rune4 = 0;
            rune4am = 0;
            gID1 = 102;
            gID2 = 103;
            gID3 = 104;
            return true;
        }
        if (i == 1154) {
            rune1 = 555;
            rune1am = 1;
            rune2 = 556;
            rune2am = 1;
            rune3 = 558;
            rune3am = 1;
            rune4 = 0;
            rune4am = 0;
            gID1 = 93;
            gID2 = 94;
            gID3 = 95;
            return true;
        }
        if (i == 1156) {
            rune1 = 557;
            rune1am = 2;
            rune2 = 556;
            rune2am = 1;
            rune3 = 558;
            rune3am = 1;
            rune4 = 0;
            rune4am = 0;
            gID1 = 96;
            gID2 = 97;
            gID3 = 98;
            return true;
        }
        if (i == 12445) {
            rune1 = 0;
            rune1am = 0;
            rune2 = 0;
            rune2am = 0;
            rune3 = 0;
            rune3am = 0;
            rune4 = 0;
            rune4am = 0;
            gID1 = 344;
            gID2 = 344;
            gID3 = 345;
            return true;
        }
        if (i == 1157) {
            rune1 = 555;
            rune1am = 3;
            rune2 = 557;
            rune2am = 2;
            rune3 = 559;
            rune3am = 1;
            rune4 = 0;
            rune4am = 0;
            gID1 = 105;
            gID2 = 106;
            gID3 = 107;
            return true;
        }
        if (i == 1158) {
            rune1 = 554;
            rune1am = 3;
            rune2 = 556;
            rune2am = 2;
            rune3 = 558;
            rune3am = 1;
            rune4 = 0;
            rune4am = 0;
            gID1 = 99;
            gID2 = 100;
            gID3 = 101;
            return true;
        }
        if (i == 1160) {
            rune1 = 556;
            rune1am = 2;
            rune2 = 562;
            rune2am = 1;
            rune3 = 0;
            rune3am = 0;
            rune4 = 0;
            rune4am = 0;
            gID1 = 117;
            gID2 = 118;
            gID3 = 119;
            return true;
        }
        if (i == 1161) {
            rune1 = 555;
            rune1am = 3;
            rune2 = 557;
            rune2am = 2;
            rune3 = 559;
            rune3am = 1;
            rune4 = 0;
            rune4am = 0;
            gID1 = 108;
            gID2 = 109;
            gID3 = 110;
            return true;
        }
        if (i == 1572) {
            rune1 = 555;
            rune1am = 3;
            rune2 = 557;
            rune2am = 3;
            rune3 = 559;
            rune3am = 2;
            rune4 = 0;
            rune4am = 0;
            gID1 = 177;
            gID2 = 178;
            gID3 = 179;
            return true;
        }
        if (i == 1171) {
            rune1 = 557;
            rune1am = 2;
            rune2 = 556;
            rune2am = 2;
            rune3 = 562;
            rune3am = 1;
            rune4 = 0;
            rune4am = 0;
            gID1 = 145;
            gID2 = 146;
            gID3 = 147;
            return true;
        }
        if (i == 12037) {
            rune1 = 560;
            rune1am = 1;
            rune2 = 558;
            rune2am = 4;
            rune3 = 0;
            rune3am = 0;
            rune4 = 0;
            rune4am = 0;
            gID1 = 330;
            gID2 = 330;
            gID3 = 329;
            return true;
        }
        if (i == 1582) {
            rune1 = 555;
            rune1am = 4;
            rune2 = 557;
            rune2am = 4;
            rune3 = 559;
            rune3am = 3;
            rune4 = 0;
            rune4am = 0;
            gID1 = 177;
            gID2 = 178;
            gID3 = 180;
            return true;
        }
        if (i == 1539) {
            rune1 = 554;
            rune1am = 5;
            rune2 = 560;
            rune2am = 1;
            rune3 = 0;
            rune3am = 0;
            rune4 = 0;
            rune4am = 0;
            gID1 = 87;
            gID2 = 88;
            gID3 = 89;
            return true;
        }
        if (i == 1542) {
            rune1 = 555;
            rune1am = 5;
            rune2 = 557;
            rune2am = 5;
            rune3 = 566;
            rune3am = 1;
            rune4 = 0;
            rune4am = 0;
            gID1 = 108;
            gID2 = 109;
            gID3 = 110;
            return true;
        }
        if (i == 1543) {
            rune1 = 555;
            rune1am = 8;
            rune2 = 557;
            rune2am = 8;
            rune3 = 566;
            rune3am = 1;
            rune4 = 0;
            rune4am = 0;
            gID1 = 105;
            gID2 = 106;
            gID3 = 107;
            return true;
        }
        if (i == 1562) {
            rune1 = 555;
            rune1am = 12;
            rune2 = 557;
            rune2am = 12;
            rune3 = 566;
            rune3am = 1;
            rune4 = 0;
            rune4am = 0;
            gID1 = 102;
            gID2 = 103;
            gID3 = 104;
            return true;
        }
        if (i == 1592) {
            rune1 = 555;
            rune1am = 5;
            rune2 = 557;
            rune2am = 5;
            rune3 = 559;
            rune3am = 4;
            rune4 = 0;
            rune4am = 0;
            gID1 = 177;
            gID2 = 178;
            gID3 = 181;
            return true;
        }
        if (i == 1163) {
            rune1 = 555;
            rune1am = 2;
            rune2 = 556;
            rune2am = 2;
            rune3 = 562;
            rune3am = 1;
            rune4 = 0;
            rune4am = 0;
            gID1 = 120;
            gID2 = 121;
            gID3 = 122;
            return true;
        }
        if (i == 1166) {
            rune1 = 557;
            rune1am = 3;
            rune2 = 556;
            rune2am = 2;
            rune3 = 562;
            rune3am = 1;
            rune4 = 0;
            rune4am = 0;
            gID1 = 123;
            gID2 = 124;
            gID3 = 125;
            return true;
        }
        if (i == 1169) {
            rune1 = 554;
            rune1am = 4;
            rune2 = 556;
            rune2am = 3;
            rune3 = 562;
            rune3am = 1;
            rune4 = 0;
            rune4am = 0;
            gID1 = 126;
            gID2 = 127;
            gID3 = 128;
            return true;
        }
        if (i == 1172) {
            rune1 = 556;
            rune1am = 3;
            rune2 = 560;
            rune2am = 1;
            rune3 = 0;
            rune3am = 0;
            rune4 = 0;
            rune4am = 0;
            gID1 = 132;
            gID2 = 133;
            gID3 = 134;
            return true;
        }
        if (i == 1175) {
            rune1 = 556;
            rune1am = 3;
            rune2 = 560;
            rune2am = 1;
            rune3 = 555;
            rune3am = 3;
            rune4 = 0;
            rune4am = 0;
            gID1 = 135;
            gID2 = 136;
            gID3 = 137;
            return true;
        }
        if (i == 1177) {
            rune1 = 556;
            rune1am = 3;
            rune2 = 560;
            rune2am = 1;
            rune3 = 557;
            rune3am = 4;
            rune4 = 0;
            rune4am = 0;
            gID1 = 138;
            gID2 = 139;
            gID3 = 140;
            return true;
        }
        if (i == 1181) {
            rune1 = 554;
            rune1am = 5;
            rune2 = 560;
            rune2am = 1;
            rune3 = 555;
            rune3am = 4;
            rune4 = 0;
            rune4am = 0;
            gID1 = 129;
            gID2 = 130;
            gID3 = 131;
            return true;
        }
        if (i == 1183) {
            rune1 = 556;
            rune1am = 4;
            rune2 = 565;
            rune2am = 1;
            rune3 = 0;
            rune3am = 0;
            rune4 = 0;
            rune4am = 0;
            gID1 = 158;
            gID2 = 159;
            gID3 = 160;
            return true;
        }
        if (i == 1185) {
            rune1 = 556;
            rune1am = 4;
            rune2 = 565;
            rune2am = 1;
            rune3 = 555;
            rune3am = 7;
            rune4 = 0;
            rune4am = 0;
            gID1 = 161;
            gID2 = 162;
            gID3 = 163;
            return true;
        }
        if (i == 1188) {
            rune1 = 556;
            rune1am = 4;
            rune2 = 565;
            rune2am = 1;
            rune3 = 557;
            rune3am = 7;
            rune4 = 0;
            rune4am = 0;
            gID1 = 164;
            gID2 = 165;
            gID3 = 166;
            return true;
        }
        if (i == 1189) {
            rune1 = 556;
            rune1am = 5;
            rune2 = 565;
            rune2am = 1;
            rune3 = 554;
            rune3am = 7;
            rune4 = 0;
            rune4am = 0;
            gID1 = 155;
            gID2 = 156;
            gID3 = 157;
            return true;
        }
        if (i == 1191) {
            rune1 = 554;
            rune1am = 2;
            rune2 = 565;
            rune2am = 2;
            rune3 = 556;
            rune3am = 4;
            rune4 = 0;
            rune4am = 0;
            gID1 = 77;
            gID2 = 0;
            gID3 = 0;
            return true;
        }
        if (i == 1192) {
            rune1 = 554;
            rune1am = 2;
            rune2 = 565;
            rune2am = 2;
            rune3 = 556;
            rune3am = 4;
            rune4 = 0;
            rune4am = 0;
            gID1 = 78;
            gID2 = 0;
            gID3 = 0;
            return true;
        }
        if (i == 1190) {
            rune1 = 554;
            rune1am = 2;
            rune2 = 565;
            rune2am = 2;
            rune3 = 556;
            rune3am = 4;
            rune4 = 0;
            rune4am = 0;
            gID1 = 76;
            gID2 = 0;
            gID3 = 0;
            return true;
        }
        if (i == 12939) {
            rune1 = 560;
            rune1am = 2;
            rune2 = 562;
            rune2am = 2;
            rune3 = 554;
            rune3am = 1;
            rune4 = 556;
            rune4am = 1;
            gID1 = 384;
            gID2 = 384;
            gID3 = 385;
            return true;
        }
        if (i == 12987) {
            rune1 = 560;
            rune1am = 2;
            rune2 = 562;
            rune2am = 2;
            rune3 = 566;
            rune3am = 1;
            rune4 = 556;
            rune4am = 1;
            gID1 = 378;
            gID2 = 378;
            gID3 = 380;
            return true;
        }
        if (i == 12901) {
            rune1 = 560;
            rune1am = 2;
            rune2 = 565;
            rune2am = 1;
            rune3 = 562;
            rune3am = 2;
            rune4 = 0;
            rune4am = 0;
            gID1 = 374;
            gID2 = 374;
            gID3 = 373;
            return true;
        }
        if (i == 12861) {
            rune1 = 560;
            rune1am = 2;
            rune2 = 562;
            rune2am = 2;
            rune3 = 554;
            rune3am = 2;
            rune4 = 0;
            rune4am = 0;
            gID1 = 361;
            gID2 = 360;
            gID3 = 361;
            return true;
        }
        if (i == 12963) {
            rune1 = 560;
            rune1am = 2;
            rune2 = 562;
            rune2am = 4;
            rune3 = 554;
            rune3am = 2;
            rune4 = 556;
            rune4am = 2;
            gID1 = 387;
            gID2 = 0;
            gID3 = 0;
            return true;
        }
        if (i == 13011) {
            rune1 = 560;
            rune1am = 2;
            rune2 = 562;
            rune2am = 4;
            rune3 = 566;
            rune3am = 2;
            rune4 = 556;
            rune4am = 2;
            gID1 = 381;
            gID2 = 0;
            gID3 = 0;
            return true;
        }
        if (i == 12919) {
            rune1 = 560;
            rune1am = 2;
            rune2 = 565;
            rune2am = 2;
            rune3 = 562;
            rune3am = 4;
            rune4 = 0;
            rune4am = 0;
            gID1 = 376;
            gID2 = 0;
            gID3 = 0;
            return true;
        }
        if (i == 12881) {
            rune1 = 560;
            rune1am = 2;
            rune2 = 562;
            rune2am = 4;
            rune3 = 555;
            rune3am = 4;
            rune4 = 0;
            rune4am = 0;
            gID1 = 363;
            gID2 = 0;
            gID3 = 0;
            return true;
        }
        if (i == 12951) {
            rune1 = 560;
            rune1am = 2;
            rune2 = 565;
            rune2am = 2;
            rune3 = 554;
            rune3am = 2;
            rune4 = 556;
            rune4am = 2;
            gID1 = 537;
            gID2 = 537;
            gID3 = 388;
            return true;
        }
        if (i == 12999) {
            rune1 = 560;
            rune1am = 2;
            rune2 = 565;
            rune2am = 2;
            rune3 = 566;
            rune3am = 2;
            rune4 = 556;
            rune4am = 2;
            gID1 = 378;
            gID2 = 378;
            gID3 = 382;
            return true;
        }
        if (i == 12911) {
            rune1 = 560;
            rune1am = 2;
            rune2 = 565;
            rune2am = 4;
            rune3 = 0;
            rune3am = 0;
            rune4 = 0;
            rune4am = 0;
            gID1 = 374;
            gID2 = 374;
            gID3 = 375;
            return true;
        }
        if (i == 12871) {
            rune1 = 560;
            rune1am = 2;
            rune2 = 565;
            rune2am = 2;
            rune3 = 555;
            rune3am = 3;
            rune4 = 0;
            rune4am = 0;
            gID1 = 368;
            gID2 = 0;
            gID3 = 0;
            return true;
        }
        if (i == 12975) {
            rune1 = 560;
            rune1am = 4;
            rune2 = 565;
            rune2am = 2;
            rune3 = 554;
            rune3am = 4;
            rune4 = 556;
            rune4am = 4;
            gID1 = 538;
            gID2 = 0;
            gID3 = 0;
            return true;
        }
        if (i == 13023) {
            rune1 = 560;
            rune1am = 4;
            rune2 = 565;
            rune2am = 2;
            rune3 = 566;
            rune3am = 3;
            rune4 = 554;
            rune4am = 4;
            gID1 = 383;
            gID2 = 0;
            gID3 = 0;
            return true;
        }
        if (i == 12929) {
            rune1 = 560;
            rune1am = 4;
            rune2 = 565;
            rune2am = 4;
            rune3 = 566;
            rune3am = 1;
            rune4 = 0;
            rune4am = 0;
            gID1 = 377;
            gID2 = 0;
            gID3 = 0;
            return true;
        }
        if (i == 12891) {
            rune1 = 560;
            rune1am = 4;
            rune2 = 565;
            rune2am = 2;
            rune3 = 555;
            rune3am = 6;
            rune4 = 0;
            rune4am = 0;
            gID1 = 369;
            gID2 = 0;
            gID3 = 0;
            return true;
        } else {
            return false;
        }
    }

    public boolean FreezeNPC(int i) {
        if (i == 1572) {
            return true;
        }
        if (i == 1582) {
            return true;
        }
        if (i == 1592) {
            return true;
        }
        if (i == 12861) {
            return true;
        }
        if (i == 12881) {
            return true;
        }
        if (i == 12871) {
            return true;
        }
        return i == 12891;
    }

    public boolean PoisonNPC(int i) {
        if (i == 12939) {
            return true;
        }
        if (i == 12963) {
            return true;
        }
        if (i == 12951) {
            return true;
        }
        return i == 12975;
    }

    public boolean DrainNPC(int i) {
        if (i == 12901) {
            return true;
        }
        if (i == 12919) {
            return true;
        }
        if (i == 12911) {
            return true;
        }
        return i == 12929;
    }

    public int Emote(int i) {
        if (i == 1191) {
            return 811;
        }
        if (i == 12445) {
            return 1819;
        }
        if (i == 1192) {
            return 811;
        }
        if (i == 1190) {
            return 811;
        }
        if (i == 12939) {
            return 1978;
        }
        if (i == 12987) {
            return 1978;
        }
        if (i == 12901) {
            return 1978;
        }
        if (i == 12861) {
            return 1978;
        }
        if (i == 12963) {
            return 1978;
        }
        if (i == 13011) {
            return 1978;
        }
        if (i == 12919) {
            return 1978;
        }
        if (i == 12881) {
            return 1978;
        }
        if (i == 12951) {
            return 1978;
        }
        if (i == 12999) {
            return 1978;
        }
        if (i == 12911) {
            return 1978;
        }
        if (i == 12871) {
            return 1978;
        }
        if (i == 12975) {
            return 1979;
        }
        if (i == 13023) {
            return 1979;
        }
        if (i == 12929) {
            return 1979;
        }
        return i != 12891 ? 711 : 1979;
    }

    public int MagicLevelNeeded(int i) {
        if (i == 1152) {
            return 0;
        }
        if (i == 1153) {
            return 3;
        }
        if (i == 1154) {
            return 5;
        }
        if (i == 1156) {
            return 9;
        }
        if (i == 1157) {
            return 11;
        }
        if (i == 1158) {
            return 13;
        }
        if (i == 1160) {
            return 17;
        }
        if (i == 1161) {
            return 19;
        }
        if (i == 1572) {
            return 20;
        }
        if (i == 1171) {
            return 39;
        }
        if (i == 12037) {
            return 50;
        }
        if (i == 1582) {
            return 50;
        }
        if (i == 1539) {
            return 50;
        }
        if (i == 1542) {
            return 66;
        }
        if (i == 1543) {
            return 73;
        }
        if (i == 1562) {
            return 80;
        }
        if (i == 1592) {
            return 79;
        }
        if (i == 12445) {
            return 85;
        }
        if (i == 1163) {
            return 23;
        }
        if (i == 1166) {
            return 29;
        }
        if (i == 1169) {
            return 35;
        }
        if (i == 1172) {
            return 41;
        }
        if (i == 1175) {
            return 47;
        }
        if (i == 1177) {
            return 53;
        }
        if (i == 1181) {
            return 59;
        }
        if (i == 1183) {
            return 62;
        }
        if (i == 1185) {
            return 65;
        }
        if (i == 1188) {
            return 70;
        }
        if (i == 1189) {
            return 75;
        }
        if (i == 1191) {
            return 60;
        }
        if (i == 1192) {
            return 60;
        }
        if (i == 1190) {
            return 60;
        }
        if (i == 12939) {
            return 50;
        }
        if (i == 12987) {
            return 52;
        }
        if (i == 12901) {
            return 56;
        }
        if (i == 12861) {
            return 58;
        }
        if (i == 12963) {
            return 62;
        }
        if (i == 13011) {
            return 64;
        }
        if (i == 12919) {
            return 68;
        }
        if (i == 12881) {
            return 70;
        }
        if (i == 12951) {
            return 74;
        }
        if (i == 12999) {
            return 76;
        }
        if (i == 12911) {
            return 80;
        }
        if (i == 12871) {
            return 82;
        }
        if (i == 12975) {
            return 86;
        }
        if (i == 13023) {
            return 88;
        }
        if (i == 12929) {
            return 92;
        }
        return i != 12891 ? 0 : 94;
    }

    public int SpellDamage(int i) {
        if (i == 1152) {
            return 2;
        }
        if (i == 1153) {
            return 5;
        }
        if (i == 1154) {
            return 5;
        }
        if (i == 1156) {
            return 9;
        }
        if (i == 1157) {
            return 5;
        }
        if (i == 1158) {
            return 11;
        }
        if (i == 1160) {
            return 12;
        }
        if (i == 1161) {
            return 5;
        }
        if (i == 1572) {
            return 5;
        }
        if (i == 12445) {
            return 5;
        }
        if (i == 1171) {
            return 15;
        }
        if (i == 12037) {
            return 20;
        }
        if (i == 1582) {
            return 5;
        }
        if (i == 1539) {
            return 20;
        }
        if (i == 1542) {
            return 5;
        }
        if (i == 1543) {
            return 5;
        }
        if (i == 1562) {
            return 5;
        }
        if (i == 1592) {
            return 5;
        }
        if (i == 1163) {
            return 14;
        }
        if (i == 1166) {
            return 15;
        }
        if (i == 1169) {
            return 16;
        }
        if (i == 1172) {
            return 17;
        }
        if (i == 1175) {
            return 18;
        }
        if (i == 1177) {
            return 19;
        }
        if (i == 1181) {
            return 21;
        }
        if (i == 1183) {
            return 25;
        }
        if (i == 1185) {
            return 27;
        }
        if (i == 1188) {
            return 29;
        }
        if (i == 1189) {
            return 30;
        }
        if (i == 1191) {
            return charge < 1 ? 20 : 30;
        }
        if (i == 1192) {
            return charge < 1 ? 20 : 30;
        }
        if (i == 1190) {
            return charge < 1 ? 20 : 30;
        }
        if (i == 12939) {
            return 13;
        }
        if (i == 12987) {
            return 14;
        }
        if (i == 12901) {
            return 15;
        }
        if (i == 12861) {
            return 16;
        }
        if (i == 12963) {
            return 17;
        }
        if (i == 13011) {
            return 19;
        }
        if (i == 12919) {
            return 21;
        }
        if (i == 12881) {
            return 22;
        }
        if (i == 12951) {
            return 23;
        }
        if (i == 12999) {
            return 24;
        }
        if (i == 12911) {
            return 25;
        }
        if (i == 12871) {
            return 26;
        }
        if (i == 12975) {
            return 27;
        }
        if (i == 13023) {
            return 28;
        }
        if (i == 12929) {
            return 29;
        }
        return i != 12891 ? 0 : 30;
    }
}
